package com.xx.rpc.core.remoting.net;

import com.xx.rpc.core.remoting.invoker.reference.XxRpcReferenceBean;
import com.xx.rpc.core.remoting.net.params.XxRpcRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class Client {
    protected static final Logger logger = LoggerFactory.getLogger(Client.class);


    // ---------------------- init ----------------------
    //volatile 用来标记存储于主内存中
    protected volatile XxRpcReferenceBean xxlRpcReferenceBean;

    public void init(XxRpcReferenceBean xxlRpcReferenceBean) {
        this.xxlRpcReferenceBean = xxlRpcReferenceBean;
    }


    // ---------------------- send ----------------------

    /**
     * async send, bind requestId and future-response
     *
     * @param address 地址
     * @param xxlRpcRequest 请求参数
     * @throws Exception 错误信息
     */
    public abstract void asyncSend(String address, XxRpcRequest xxlRpcRequest) throws Exception;
}
